<template>
    <el-row :gutter="24">
        <el-col :span="4">
            <el-card>
                时间：{{ time1 }}
            </el-card>
        </el-col>
        <el-col :span="4">
            <el-card>
                金币：{{ gold }}
            </el-card>
        </el-col>

       <el-col class="map" :span="24">
           <el-row :gutter="10" v-for="(row, index) in gameMap" :key="index">
               <el-col :span="1" v-for="(item, iindex) in row" :key="'b'+index+iindex">
<!--                   <land v-if="item != 0" :pic-src="TREE"></land>-->
                       <land :pic-src="TREE"></land>

               </el-col>

           </el-row>
       </el-col>
    </el-row>
</template>

<script>
import land from "@/components/game/land";
export default {
    name: "Record",
    data: function () {
        return {
            "time1": 0,
            "gold": 0,
            gameMap:[],
            TREE:require("./../../assets/gameImg/tree.png"),
        }
    },
    methods: {
        record(){
            let that = this;
            setInterval(function (){
                that.time1 += 1;
                that.gold += 1;
            },1000)
        }
    },
    components:{
        land,
    },
    beforeCreate() {
        this.gameMap = new Array(10)
        for (let i = 0; i < 10; i++) {
            let tem = new Array(10)
            this.gameMap[i] = tem;
        }
        this.gameMap[0][0] = 1
        console.log(this.gameMap)
    },
    beforeMounted() {

    },
    beforeMount() {
        this.record();
    },

}
</script>

<style scoped>

</style>